package com.huiyeji.dynamic.core.bean;

import com.huiyeji.dynamic.core.annotations.DynamicBean;
@DynamicBean("long")
public class DynamicLong {

    public long of(Object obj){
        if (obj instanceof Long){
            return (Long) obj;
        } else if (obj instanceof String){
            return Long.parseLong((String) obj);
        } else if (obj instanceof Number){
            return ((Number) obj).longValue();
        } else {
            throw new RuntimeException("数据无法转换");
        }
    }

    public long sub(long num1,long num2){
        return num1 - num2;
    }

    public long add(long num1,long num2){
        return num1 + num2;
    }
}
